<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>

        <script type="text/javascript">


            function f1(){
                console.log('Hello World!');

                var i=100;

                console.log(i);

                console.log(typeof i);

                i=false;

                console.log(i);

                console.log(typeof i);

                i='abc';
                i="abc";

                console.log(i);

                console.log(typeof i);

                i=null;

                console.log(i);

                console.log(typeof i);

                var a;

                console.log(a);

                console.log(typeof a);
            }


            /*
                undefiend   结果为false
                string      空字符串为false，反之为true
                number      0为false，反之为true
                object      null为false，反之为true

             */
            function f2(){
                var i=new Object();
                if(i){
                    alert(true);
                }else{
                    alert(false);
                }
            }


            function f3(){
                var s1="123";
                var s2="abc";

                console.log(s1+s2);

                console.log(s1+1);

                //string->number
                var i=parseInt(s1);

                console.log(i+1)

                console.log(typeof i)

                var s3="123abc";

                console.log(parseInt(s3));

                var s4="abc123";

                console.log(parseInt(s4));//NaN  not a nnumber

                console.log(typeof parseInt(s4));

                var n=1/0;

                console.log(n);//Infinity 无穷大

                console.log(n>546);

                var s5="12.345";

                console.log(parseInt(s5));

                console.log(parseFloat(s5));

                console.log(12.345-12);

                console.log(2.6-2);

                console.log(123+"");
            }


        </script>


    </head>
    <body>
        <input type="button" value="test1" onclick="f1();"/>
        <input type="button" value="test2" onclick="f2();"/>
        <input type="button" value="test3" onclick="f3();"/>
    </body>
</html>